package com.demo.utils;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.demo.dao.HibernateBaseDao;

/**
 * 时间类，获取数据库时间
 * @author tomosun
 *
 */
public class Dates{
	
	private  HibernateBaseDao dao;
	
	public  Dates(){
	   ApplicationContext ctx = new ClassPathXmlApplicationContext("../applicationContext.xml"); 
	   dao = (HibernateBaseDao)ctx.getBean("hibernateBaseDao"); 
	}
	
	  
	/**
	 * 获取当前日期，格式：yyyy-mm-dd   
	 * @return
	 */
	public String getDay(){   
		List l =  dao.findBySql(" select to_char(sysdate,'YYYY-MM-DD') chardate from dual");		
		return l.get(0).toString();
	}



	
}
